﻿<?php 
	require_once 'Webconfig.php'; 
	require_once 'Const.php';
	require_once 'Base.php';
	require_once 'Extend.php';
	
	class Options
	{
	}
	
	class Func
	{
	}
	
	///summary
	///管理登录类
	///summary
	class Manager
	{
		public $userid=null;
		public $password=null;
		public $con=null;
		
		private $isLogin=false;
		private $state='未登录';
		
		function __construct($userid=null,$password=null,$con=null)
		{			
			$this->userid=$userid;
			$this->password=$password;
			$this->con=$con;
		}
		function __destruct()
		{
			$this->userid=null;
			$this->password=null;
			$this->isLogin=null;
			$this->state=null;			
		}		
	    function __get($property_name)
		{
			if(isset($this->$property_name)){
				return($this->$property_name);
			}
			else{
				PrintError($_SERVER['SCRIPT_NAME'].' 出错','Class.Manager类 没有 '.$property_name.' 属性');
				exit();
			}			
		}		
		function __set($property_name,$value)
		{	
			if(isset($this->$property_name))
			{
			
				if($property_name=='isLogin'||$property_name=='state'){
					PrintWarming($_SERVER['SCRIPT_NAME'].' 出错','App_Code.Class.Manager类警告。'.$property_name.' 属性不能设置，只能由程序自己返回。');
					exit();
				}
				$this->$property_name = $value;
			}
			else
			{
				PrintError($_SERVER['SCRIPT_NAME'].' 出错','Class.Manager类 没有 '.$property_name.' 属性');
				exit();				
			}
		}
		
		public function ToLogin()
		{
			$result=mysql_fetch_array(mysql_query('select * from System_Manager where userid=\''.$this->userid.'\' limit 0,1',$this->con));
			
			if($result==null)
			{
				$this->isLogin=false;
				$this->state='无用户';
			}
			else
			{
				if($result[2]!=$this->password){
				  $this->isLogin=false;
				  $this->state='密码错误';
				}
				else{
				  $this->isLogin=true;
				  $this->state='登录成功';
				}				
			}
		}		
	}
	
	class Manage
	{
	
	}
?>
